package lanqiao;
/**
 * @Project : AlgorithmLearning
 * @Package : LanQiao.PrepareForCompetition
 * @File : Q0098.java
 * @Author : WangRuoyu
 * @Date : 2023/3/24 16:52
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Q0098 {

    static int n;
    static final int N = 10010;
    static int[] nums;
    static boolean[] f;

    static int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] words = br.readLine().split(" ");

        n = Integer.parseInt(words[0]);
        nums = new int[n + 1];
        int d = 0;

        for (int i = 1; i <= n; ++i) {
            words = br.readLine().split(" ");
            nums[i] = Integer.parseInt(words[0]);
            if (d == 0) {
                d = nums[i];
                continue;
            }
            d = gcd(d, nums[i]);
        }

        if (d > 1) {
            System.out.println("INF");
            return;
        }

        f = new boolean[N];
        f[0] = true;
        for (int i = 1; i <= n; ++i) {
            for (int j = 0; j < N; ++j) {
                if (j >= nums[i]) {
                    f[j] |= f[j - nums[i]];
                }
            }
        }
        int res = 0;
        for (int i = 0; i < N; ++i) {
            if (!f[i]) {
                res++;
            }
        }
        System.out.println(res);
    }
}

